﻿<UserControl x:Class="MultiEventCommand.UserControls.ClientUserControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mecb="clr-namespace:MultiEventCommandBinder;assembly=MultiEventCommandBinder" mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <Style TargetType="CheckBox">
            <Setter Property="Margin" Value="3,5,3,5"/>
        </Style>
        <Style TargetType="TextBlock">
            <Setter Property="Margin" Value="3,5,3,5"/>
            <Setter Property="Foreground" Value="Navy"/>
        </Style>
    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>
        <StackPanel Grid.ColumnSpan="2">
            <TextBlock HorizontalAlignment="Center" FontSize="14" FontWeight="Bold">Test the following event on this usercontrol</TextBlock>
            <TextBlock>1:MouseDown</TextBlock>
            <TextBlock>2:MouseUp</TextBlock>
            <TextBlock>3:MouseMove</TextBlock>
            <TextBlock>4:MouseEnter</TextBlock>
            <TextBlock>5:MouseLeave</TextBlock>
        </StackPanel>
        <DockPanel Grid.Row="1"  VerticalAlignment="Stretch" HorizontalAlignment="Stretch" LastChildFill="True"
                  >
            <Canvas  mecb:CommandBehavior.Event="MouseDown,MouseEnter,MouseMove,MouseUp,MouseLeave" Background="LightBlue" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"
                     mecb:CommandBehavior.Command="{Binding DockPanelCommandCollection}"
                     mecb:CommandBehavior.CommandParameter="{Binding ElementName=txtCommandParameter,Path=Text}" >
                <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" TextWrapping="Wrap">Test Mouse Event In This Block</TextBlock>
            </Canvas>
        </DockPanel>
        <StackPanel Grid.Row="1" Grid.Column="1">
            <GroupBox>
                <StackPanel>
                    <TextBlock>Can Execute:</TextBlock>
                    <CheckBox IsChecked="{Binding MouseDownIsChecked}">Disable MousDown Event</CheckBox>
                    <CheckBox IsChecked="{Binding MouseUpIsChecked}">Disable MousUp Event</CheckBox>
                    <CheckBox IsChecked="{Binding MouseMoveIsChecked}">Disable MousMove Event</CheckBox>
                    <CheckBox IsChecked="{Binding MouseEnterIsChecked}">Disable MousEnter Event</CheckBox>
                    <CheckBox IsChecked="{Binding MouseLeaveIsChecked}">Disable MousLeave Event</CheckBox>
                </StackPanel>
            </GroupBox>
            
            <StackPanel Orientation="Horizontal" Margin="5">
                <TextBlock VerticalAlignment="Center">Command Parameter:</TextBlock>
                <TextBox x:Name="txtCommandParameter" Width="80" MaxLength="8" Background="LightGreen">123</TextBox>
            </StackPanel>
        </StackPanel>
        <StackPanel Grid.Row="2" Grid.ColumnSpan="2">
            <StackPanel Orientation="Horizontal" >
                <TextBlock>Event last fired:</TextBlock>
                <TextBlock x:Name="txtLastEventFired" Text="{Binding LastEvent}"></TextBlock>
            </StackPanel>
            <StackPanel Orientation="Horizontal" >
                <TextBlock>Commadn Parameter:</TextBlock>
                <TextBlock x:Name="txtCommandsCommandParamter" Text="{Binding CommandParameterValue}"></TextBlock>
            </StackPanel>
            <StackPanel Orientation="Horizontal" >
                <TextBlock>Left Button State:</TextBlock>
                <TextBlock x:Name="txtLeftButtonState" Text="{Binding LeftButtonState}"></TextBlock>
            </StackPanel>
            <StackPanel Orientation="Horizontal" >
                <TextBlock>Right Button State:</TextBlock>
                <TextBlock x:Name="txtRightButtonState" Text="{Binding RightButtonState}"></TextBlock>
            </StackPanel>
        </StackPanel>
      
    </Grid>
</UserControl>
